UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6IgE/AUVsc9DB6NAUnPdxzIgiyS2UIM0oZQIoSICt1o='
WHERE
key_id = 'f3249835fade57bde9b2ae29068fd10e9d7ef0a7cd708b70be3eb86c2419ebd2'
AND (
token = '6IgE/AUVsc9DB6NAUnPdxzIgiyS2UIM0oZQIoSICt1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)