UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uMJYb6ApTEjCRCB7UdO/5PH4s66CNBEZ+cerY8Uyp2M=' 
WHERE 
  key_id = 'f0854d70ac114a7f6a3fdd3da8f2d05f2fbafa190ff13da8b5e6fe7ac638aed0' 
  AND (
    token = 'uMJYb6ApTEjCRCB7UdO/5PH4s66CNBEZ+cerY8Uyp2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025