UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J5LQqpkGZlE88HH94vJl/Gbky6FONnu+1iIjSS9PBiM='
WHERE
key_id = '4277bc630b015863ebc2c6b3c9d11a91573c8c2e318f7b16778246f8491086a4'
AND (
token = 'J5LQqpkGZlE88HH94vJl/Gbky6FONnu+1iIjSS9PBiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)