UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K9XeF6ZYcDmWPBn03MM6gQ/qXxiFnVu7wgJ2pm+xYSg='
WHERE
key_id = 'a8f4f27c4e9e1346688b9ec0f8737655680b0e33704adf5d126e532130a72c6c'
AND (
token = 'K9XeF6ZYcDmWPBn03MM6gQ/qXxiFnVu7wgJ2pm+xYSg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)