UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9AGJTa5o/94Diw4Je6pFC5mJMmQmIRKG9rVosIKMOls='
WHERE
key_id = 'c38618db4e03143e6279ea2ea329258cc717747ff59084ab3f14b0b411db5ff4'
AND (
token = '9AGJTa5o/94Diw4Je6pFC5mJMmQmIRKG9rVosIKMOls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)