UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJ1fiCYhrTyc+Zd5OCoy72c9b+kWUKGWitIjfJMEGVM='
WHERE
key_id = '4775bfb0dfad2777e8c8d331642984eeaa5012c38494bdba6eb15cce77ae67ed'
AND (
token = 'bJ1fiCYhrTyc+Zd5OCoy72c9b+kWUKGWitIjfJMEGVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)