UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nXYouiXT5qJxfxeZ8I1t52Ec4TayuMVAobl1tsZw2gg='
WHERE
key_id = '1f6b0ad8b76323e613086fa217e56e59788137aa75279a9da39eff34e39e4e74'
AND (
token = 'nXYouiXT5qJxfxeZ8I1t52Ec4TayuMVAobl1tsZw2gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)