UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZQuiHIOawYFqBsQsXZBEsU8HWpQ4DuK9xjy0WYUqaLI=' 
WHERE 
  key_id = '99d230d4144c449a1678a59f2292eeb739b748b3c7fd95eab1e086efc2cec66f' 
  AND (
    token = 'ZQuiHIOawYFqBsQsXZBEsU8HWpQ4DuK9xjy0WYUqaLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028