UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qEnYQUvlweX3QSeBt3wAciOFaZGyoFosxqq32n9nrrU='
WHERE
key_id = '7aa8108db7e163d02e04e264886a59fb5e60d6069be3f1f673df3668972745f0'
AND (
token = 'qEnYQUvlweX3QSeBt3wAciOFaZGyoFosxqq32n9nrrU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)