UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Xz6om14Ufwq89e8E0HLBqbmWXVy7627JgH3rU+GXr0=' 
WHERE 
  key_id = 'e77bb7fff434bca502b87bc0b00c9ca905506d48ed1c6b3d684379b5c5386113' 
  AND (
    token = '8Xz6om14Ufwq89e8E0HLBqbmWXVy7627JgH3rU+GXr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022