UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g9v/hs4jX+y89ZNyZK4BALryKzkLXX6l7E+PTu4w5ks=' 
WHERE 
  key_id = '423baab3e379fa2dfc722e908e4e4323e0ffc61482622d1b9a7e20595a2538fa' 
  AND (
    token = 'g9v/hs4jX+y89ZNyZK4BALryKzkLXX6l7E+PTu4w5ks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032