UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/IIKVwCPBrJuSR1gSweboffnULj6xi6lWvaFDTlOQ64=' 
WHERE 
  key_id = '792aebcaa8449610038e1a5f3e153818e83239a8d2b65e76d5e3d541a54537d4' 
  AND (
    token = '/IIKVwCPBrJuSR1gSweboffnULj6xi6lWvaFDTlOQ64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047