UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DX6/Qauv5uY0zzYpEwMNq8iREZMrnUGl8qA6rJzxRU8=' 
WHERE 
  key_id = '8de7a2c96448445eb2fe583428d533293c3376e8fc5a728dd136eab2f1dc11a4' 
  AND (
    token = 'DX6/Qauv5uY0zzYpEwMNq8iREZMrnUGl8qA6rJzxRU8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032