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