UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BM+CZkab78KuYTLYp1yNqmzzJ1FG9rxqGKWxTAff4C0='
WHERE
key_id = '9f9a3299d8bd0178ade84c6229cf155f197e6406d08eb7c628569b12edd77157'
AND (
token = 'BM+CZkab78KuYTLYp1yNqmzzJ1FG9rxqGKWxTAff4C0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)