UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ws8crCjvDZhY9zaVWWxNBGRhXMF/jc/MZSHpPFSNcqY='
WHERE
key_id = 'e7385c3351b3d91b0732c6ad9b7e32e1877b1a8862f587c852558145899e88c4'
AND (
token = 'ws8crCjvDZhY9zaVWWxNBGRhXMF/jc/MZSHpPFSNcqY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)