UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'geeh1n9MOGeCcUifuxP9P18dLHOTH4WHxBS0iilcIug=' 
WHERE 
  key_id = '377eb0af522e3a153dc08164991c3f038cbaf2a1af9e99106431c6d94ddba571' 
  AND (
    token = 'geeh1n9MOGeCcUifuxP9P18dLHOTH4WHxBS0iilcIug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047