UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBBc+cfYmE+e39fjrm0rdin+EMfrapECwZSflcYKVaE=' 
WHERE 
  key_id = 'ed47e20defb4d5ab8f705408888bd9e9818fa8f7d8b752b61a293420eb4c77a9' 
  AND (
    token = 'UBBc+cfYmE+e39fjrm0rdin+EMfrapECwZSflcYKVaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031