UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cFMMEiWlMuGgpFyN35GCTLs4bZ9g1nTkYAz99CDostU='
WHERE
key_id = 'd2f96f80f091994dfffb3dac7168e89d715abdd607d61aeaaf1af098f13f6818'
AND (
token = 'cFMMEiWlMuGgpFyN35GCTLs4bZ9g1nTkYAz99CDostU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)