UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QReaZmr3GrOheHakMKQoPZIdw90sy1Q4G7KVHc15MLw='
WHERE
key_id = '9c6fe4d395aac59aec38b688d1e6edcdf5f02e992fee66e28523115b9a08d6d6'
AND (
token = 'QReaZmr3GrOheHakMKQoPZIdw90sy1Q4G7KVHc15MLw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)