UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5NW9QvHU8O3VMbTd4f5atchiWdglfVEvn9GKNU8g3wU='
WHERE
key_id = '35f1ef27a02f811ae914ed875c08a1f43efa6261fdd75e8b6913b581c2028e9a'
AND (
token = '5NW9QvHU8O3VMbTd4f5atchiWdglfVEvn9GKNU8g3wU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)