UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D4gqGxIb4cjhpS7wXmqA1sBccQ9ugQ6GTKOznaL94HY='
WHERE
key_id = '94f8d1f226925816b546039778ba9ae747b5b0e4f175953239aa65bbe2a8b906'
AND (
token = 'D4gqGxIb4cjhpS7wXmqA1sBccQ9ugQ6GTKOznaL94HY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)