UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G8fP1gfuM/d+ApkYgstc2MOS7mOZF8I5yRouMh/fsag='
WHERE
key_id = '7130a1b80b39900d6a42b6edfa9d0e371a17d0273bf019c875cfcd607472c62b'
AND (
token = 'G8fP1gfuM/d+ApkYgstc2MOS7mOZF8I5yRouMh/fsag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)