UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bp2yZ3TgmTaAQMzQfIiOxLU9BgXWJo8jvrrVtX53VMc=' 
WHERE 
  key_id = 'f79144966217b32917f6ac8b29c3479b5fbe200a65cc97b5d799146651b91195' 
  AND (
    token = 'Bp2yZ3TgmTaAQMzQfIiOxLU9BgXWJo8jvrrVtX53VMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026