UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bu4JqAsTaN6tqzspsBetA9hbXZE1uZaZaB8G3oJUx/w=' 
WHERE 
  key_id = '0f803e8d68e1bdab3741043c428f73d4ddd0d8f384610952cb6d733ce91046b3' 
  AND (
    token = 'Bu4JqAsTaN6tqzspsBetA9hbXZE1uZaZaB8G3oJUx/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038