UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8rWcf61idHaDfEQMGaabdfU2fbKYXGVHO9AnxJJ09gg='
WHERE
key_id = 'b44be4a5091d97439cf86518db2d0f4f9fae40280e2973d7ac29ac73c7df8520'
AND (
token = '8rWcf61idHaDfEQMGaabdfU2fbKYXGVHO9AnxJJ09gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)