UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QBky3Df2mkAZzvOWFdgioMD2pu5ddov29KZeOaH+Beg='
WHERE
key_id = 'c40dd35153615236b8c41060e4425eb92da201fe20c54985097836d618c097f8'
AND (
token = 'QBky3Df2mkAZzvOWFdgioMD2pu5ddov29KZeOaH+Beg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)