UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BiJ667sLKdcecW97ab1fB2NtL+ge57Bi3mt/CIC7rTI='
WHERE
key_id = 'aa2d97599b1e33bb8ca13d6c3b65c25d66e61d06834dae640343ac98b8215f9f'
AND (
token = 'BiJ667sLKdcecW97ab1fB2NtL+ge57Bi3mt/CIC7rTI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)