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