UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7OsNgDJHqwyRa5HnKfk+I5VqBwui/YJ7T2Sc1WBp64w='
WHERE
key_id = 'b6288ccbc5c002afd2731a1018ce40bea9e6c1dcaec2287cd6d7c73f199e2b9d'
AND (
token = '7OsNgDJHqwyRa5HnKfk+I5VqBwui/YJ7T2Sc1WBp64w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)