UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y92KIj5B+Ln6G9hPfi6C5lm/xNWuHNYW5x5Q0yoPXeo=' 
WHERE 
  key_id = '9f12d7ef28885ce6d7e843bb12427bc2e5d742fcfd5b3af51a91ccec07939435' 
  AND (
    token = 'Y92KIj5B+Ln6G9hPfi6C5lm/xNWuHNYW5x5Q0yoPXeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040