UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YO9GiSa+YfttfFHPsmXrgcInoq8kidUbayovDtp+cgw='
WHERE
key_id = '01b40db21387d2d754e2712aaf4456272ac2089e60a7e70361b8dc1042b8f492'
AND (
token = 'YO9GiSa+YfttfFHPsmXrgcInoq8kidUbayovDtp+cgw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)