UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qE4+6qxlLjcKumj6yXqpLt69400oB6LntML6jYg/dzc='
WHERE
key_id = '2187d74f1c4ec198b0c77ffa4750d1554d24a5c5e844375b2acf0d0e12f0f000'
AND (
token = 'qE4+6qxlLjcKumj6yXqpLt69400oB6LntML6jYg/dzc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)