UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E6zYGZtSbBDbKdRiWd+tY791fkhGvzk35KypdwuAxHM=' 
WHERE 
  key_id = '66b77b9cee31074e86dfa9fd269f13ef2983055961764f5754f967ed4b138a86' 
  AND (
    token = 'E6zYGZtSbBDbKdRiWd+tY791fkhGvzk35KypdwuAxHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038