UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q851GkAsaVI6ocGQxnpBcM3Ct68ESQ4b1Rt5O14n4zg=' 
WHERE 
  key_id = '7a2b0d20af9b15aee24b40ace26602e255e8710c9e68d5d0661467b22a9691b7' 
  AND (
    token = 'Q851GkAsaVI6ocGQxnpBcM3Ct68ESQ4b1Rt5O14n4zg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053