UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sXE15YemszbjSU/GafAP82o1TvJJPQpp2QRJf1UYSZ0='
WHERE
key_id = '1904e944caa410133fee3939295dc4e1df35aec9d981b5aeaeb1ec11c4e28f5e'
AND (
token = 'sXE15YemszbjSU/GafAP82o1TvJJPQpp2QRJf1UYSZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)