UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w7UC3uq7cSa4cZCRPzPmqv2qaUO8ObFn4Y+Niis18n0=' 
WHERE 
  key_id = '69b635fb8a17e605ef79700f621bdefa280889ca7c3c9a920b41dbafa12686f7' 
  AND (
    token = 'w7UC3uq7cSa4cZCRPzPmqv2qaUO8ObFn4Y+Niis18n0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032