UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2jR4sNKwZp2cnR67kgodL0mrFapnEIBZJWACmA9BQRU='
WHERE
key_id = '64ac479de0b5f456555ad018e3a8ff7e51aca30e652c45cbfcc6039408899d82'
AND (
token = '2jR4sNKwZp2cnR67kgodL0mrFapnEIBZJWACmA9BQRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)